<script setup lang="tsx">
interface IProps {
  msg: string
}

const props = defineProps<IProps>()

const emits = defineEmits<{
  (e: 'test', id: number): void
}>()

function onTest() {
  emits('test', 1)
}

function render() {
  return (
    <div>
      <h1>我是tsx子组件--1</h1>
      <p>
        子组件-1内容:
        { props.msg }
      </p>
      <el-button onClick={onTest}>测试</el-button>
    </div>
  )
}
</script>

<template>
  <component :is="render()" />
</template>
